\(\int \frac {-1+x^2}{1+x^2} \, dx\) [46]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 6 \[ \int \frac {-1+x^2}{1+x^2} \, dx=x-2 \arctan (x) \]

[Out]

x-2*arctan(x)

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {396, 209} \[ \int \frac {-1+x^2}{1+x^2} \, dx=x-2 \arctan (x) \]

[In]

Int[(-1 + x^2)/(1 + x^2),x]

[Out]

x - 2*ArcTan[x]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rubi steps \begin{align*} \text {integral}& = x-2 \int \frac {1}{1+x^2} \, dx \\ & = x-2 \tan ^{-1}(x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.00 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \frac {-1+x^2}{1+x^2} \, dx=x-2 \arctan (x) \]

[In]

Integrate[(-1 + x^2)/(1 + x^2),x]

[Out]

x - 2*ArcTan[x]

Maple [A] (verified)

Time = 3.41 (sec) , antiderivative size = 7, normalized size of antiderivative = 1.17

method result size
default \(x -2 \arctan \left (x \right )\) \(7\)
meijerg \(x -2 \arctan \left (x \right )\) \(7\)
risch \(x -2 \arctan \left (x \right )\) \(7\)
parallelrisch \(x +i \ln \left (x -i\right )-i \ln \left (x +i\right )\) \(19\)

[In]

int((x^2-1)/(x^2+1),x,method=_RETURNVERBOSE)

[Out]

x-2*arctan(x)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \frac {-1+x^2}{1+x^2} \, dx=x - 2 \, \arctan \left (x\right ) \]

[In]

integrate((x^2-1)/(x^2+1),x, algorithm="fricas")

[Out]

x - 2*arctan(x)

Sympy [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 5, normalized size of antiderivative = 0.83 \[ \int \frac {-1+x^2}{1+x^2} \, dx=x - 2 \operatorname {atan}{\left (x \right )} \]

[In]

integrate((x**2-1)/(x**2+1),x)

[Out]

x - 2*atan(x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \frac {-1+x^2}{1+x^2} \, dx=x - 2 \, \arctan \left (x\right ) \]

[In]

integrate((x^2-1)/(x^2+1),x, algorithm="maxima")

[Out]

x - 2*arctan(x)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \frac {-1+x^2}{1+x^2} \, dx=x - 2 \, \arctan \left (x\right ) \]

[In]

integrate((x^2-1)/(x^2+1),x, algorithm="giac")

[Out]

x - 2*arctan(x)

Mupad [B] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.00 \[ \int \frac {-1+x^2}{1+x^2} \, dx=x-2\,\mathrm {atan}\left (x\right ) \]

[In]

int((x^2 - 1)/(x^2 + 1),x)

[Out]

x - 2*atan(x)